package com.yyy.spring6.auto;

import com.yyy.spring6.auto.controller.UserController;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Project ：learn_spring
 * @File ：TestUser.java
 * @IDE ：IntelliJ IDEA
 * @Author ：自由如风间
 * @Date ：2025/3/30 17:42
 * @Description ：测试代码：
 * 调用UserController，UserController调用UserService，UserService调用UserDao
 * 使用bean的autowire byType自动装配
 */

public class TestUser {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-auto.xml");
        UserController controller = context.getBean("userController", UserController.class);
        controller.addUser();
    }
}
